#include "core/potential.hpp"
#include "yocto/ios/ocstream.hpp"

namespace FastMD
{
	Potential:: ~Potential() throw()
	{
	}
	
	Potential:: Potential() throw()
	{
		
	}
	
	void Potential:: save( const string &prefix, Real rmin, Real rmax ) const
	{
		assert(rmax>rmin);
		static const size_t n = 1000;
		const string filename = prefix + name() + ".dat";
		ios::ocstream fp( filename, false );
		const Real dR = rmax - rmin;
		for( size_t i=0; i <= n; ++i )
		{
			const V3D r( rmin + (i *dR) / n, 0, 0 );
			V3D       f;
			const Real V = (*this)(f,r);
			fp("%g %g %g\n", r.x, V, f.x);
		}
	}
	
}
